import tkinter as tk

class GUI:
    def __init__(self, on_button_click, on_message_received):
        self.root = tk.Tk()
        self.root.title("模拟小智客户端程序")
        self.root.geometry("300x200")

        self.button = tk.Button(self.root, text="唤醒", command=on_button_click)
        self.button.pack(expand=True)
        
        self.text_label = tk.Label(self.root, text="")
        self.text_label.pack(expand=True)

        self.on_message_received = on_message_received

    def handle_message(self, message):
        """处理从WebSocket服务器接收到的消息"""
        self.update_text(f"收到消息: {message}")

    def update_text(self, text):
        self.text_label.config(text=text)

    def run(self):
        self.root.mainloop()